package org.ManagerSystem.enums;

public enum LoginStateEnum {

    SUCCESS(1,"登录成功！"),
    PASSWORD_ERROR(-1,"密码错误！"),
    USER_NOTFOUND(-2,"用户不存在！"),
    UNKNOW_ERROR(-3,"未知错误"),
    INNER_ERROR(-4,"内部错误！");

    private int state;
    private String stateInfo;

    private LoginStateEnum(int state , String stateInfo) {
        this.state = state;
        this.stateInfo = stateInfo;
    }

    public int getState(){
        return state;
    }

    public String getStateInfo(){
        return stateInfo;
    }

    public static LoginStateEnum stateOf(int index) {
        for(LoginStateEnum loginStateEnum : values()){
            if(loginStateEnum.getState() == index){
                return loginStateEnum;
            }
        }
        return null;
    }
}
